# Idle.gd
extends State
@onready var animated_sprite: AnimatedSprite2D = $"../../AnimatedSprite2D"
@onready var attack_timer: Timer = $"../../AttackTimer"


#TODO： 这里考虑之后要不要换成通用的受伤效果
func enter():
	attack_timer.paused = true
	animated_sprite.play("Hurt")
	var tween = create_tween()
	if animated_sprite.material is ShaderMaterial:
		animated_sprite.material.set_shader_parameter("flash_intensity", 1.0)
		tween.tween_property(animated_sprite.material, "shader_parameter/flash_intensity", 0.0, 0.3)
		tween.tween_property(animated_sprite.material, "shader_parameter/flash_intensity", 0.0, 0.15)
	await animated_sprite.animation_finished
	state_machine.transition_to("Idle")
	
func process_logic(delta: float):
	pass

func input_logic(event: InputEvent):
	pass

func exit():
	attack_timer.paused = false
	#print("敌人退出了 受伤 状态 ")
